package com.log4jviewer.filters;

import java.util.ArrayList;
import java.util.List;

/**
 * The structure which stores filter name, description and items
 * 
 * @author <a href="mailto:rd.ryly@gmail.com">Ruslan Diachenko</a>
 */

public final class FilterModel {

    private final List<FilterItemModel> items;

    private String filterName;

    private String filterDescr;

    public FilterModel() {
        items = new ArrayList<FilterItemModel>();
    }

    public String getFilterName() {
        return filterName;
    }

    public void setFilterName(final String filterName) {
        this.filterName = filterName;
    }

    public String getFilterDescr() {
        return filterDescr;
    }

    public void setFilterDescr(final String filterDescr) {
        this.filterDescr = filterDescr;
    }

    public void addItem(final FilterItemModel filterItemModel) {
        items.add(filterItemModel);
    }

    public void removeItem(final int index) {
        items.remove(index);
    }

    public int getItemsCount() {
        return items.size();
    }

    public FilterItemModel getItem(final int index) {
        return items.get(index);
    }

    public int getItemIndex(final FilterItemModel item) {
        return items.indexOf(item);
    }
}
